<template>
    <div class="home-nav">
        <!-- 导航列表 -->
        <div class="slowly-nav">
            <ul class="show-nav">
                <router-link  tag="li" :to="'/'+item.titlehref" class="show-nav-item " v-for="(item,index) in navlist" :id="item.indexmenuId" :key="item.indexmenuId">
                    <a href="#">
                          <img :src="'../../../static/images/'+item.img"alt="">
                         <p>{{item.name}}</p>
                    </a>
                </router-link>
            </ul>
        </div>
        <!-- 强烈推荐条幅 -->
         <div class="discount-goods">
            <p>超值折扣推荐</p>
            <i></i>
        </div>
        <!-- 超值折扣推荐列表 -->
        <ul class="discount-list">
            <router-link :to="'/moneyproduct/'+item.productId" tag="li" class="discount-list-item" v-for="(item,index) in discountlist" :key="item.productId">
                <div class="list-item-pic">
                    <img :src="item.productImgLg.src" :alt="item.productImgLg.alt">
                </div>
                <div class="list-item-text">
                    <h4 class="item-title">
                        {{item.productName}}
                    </h4>
                    <p class="item-price">${{item.productPinkage}}</p>
                    <p class="item-thumbs">
                        <span>{{item.productFrom}}|{{item.productTime}}</span>
                        <span class="thumbs-number">{{item.productComCount}}</span>
                    </p>
                </div>
            </router-link>
        </ul>
        <!-- 更多优惠 -->
        <!-- 更多优惠信息 -->
        <div class="more-news">
            <button>更多优惠信息>></button>
        </div>
         <!-- 品牌排行 -->
        <div class="discount-goods">
            <p>品牌排行</p>
            <i></i>
        </div>
    </div>
</template>
<script>
import axios from 'axios'
export default {
    name:"navlist",
    data(){
      return{
        navlist:[],
        discountlist:[]
      }
    },
    mounted(){
      this.getnavlist();
      this.getdiscountList()
    },
    methods:{
      getnavlist(){//获取导航数据列表
        axios({
          url:'http://localhost:3000/api/getindexmenu',
          method:"get"
        }).then(res=>{
          console.log(res)
        this.navlist=res.data.result;
        })
      },
      getdiscountList(){
        axios({//获取打折商品数据列表
          url:'http://localhost:3000/api/getmoneyctrl',
          method:"get",
          params:{
            pageid:1
          }
        }).then(res=>{
          // console.log(res)
          this.discountlist=res.data.result;
        })
      }
    }
}
</script>
<style  scoped>
.home-nav{
    width: 100%;
}
.slowly-nav {
  margin-top: 8px;
  width: 100%;
  text-align: center;
}
.slowly-nav .show-nav {
  list-style: none;
  padding: 4px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.slowly-nav .show-nav .show-nav-item {
  width: 23%;
  margin-bottom: 5px;
  text-align: center;
}
.slowly-nav .show-nav .show-nav-item img {
  display: block;
  margin-left:15px;
  width: 50px;
  height: 50px;
}
.slowly-nav .show-nav .show-nav-item p {
  font-size: 16px;
  text-align: center;
  /* margin-right:10px; */
  color: black;
}
.discount-goods {
  width: 100%;
  height: 35px;
  background: #ff9000;
  background: -webkit-gradient(linear, 0 0, 0 100%, from(#ffaf47), to(#ff9000));
  display: flex;
  justify-content: space-between;
}
.discount-goods p {
  font-size: 20px;
  line-height: 35px;
  color: white;
  font-weight: bold;
}
.discount-goods i {
  line-height: 20px;
  margin-top: 8px;
  margin-right: 5px;
  width: 20px;
  height: 20px;
  background: url('../../../static/images/more.png') no-repeat center center;
  background-size: 20px 20px;
}
.discount-list {
  width: 100%;
}
.discount-list .discount-list-item {
  width: 100%;
  max-height: 100px;
  border-bottom: 1px solid red;
  display: flex;
}
.discount-list .discount-list-item .list-item-pic {
  width: 100px;
  height: 100px;
}
.discount-list .discount-list-item .list-item-pic img {
  width: 100%;
  height: 100%;
  vertical-align: middle;
}
.discount-list .discount-list-item .list-item-text {
  flex: 1;
  padding-left: 10px;
}
.discount-list .discount-list-item .list-item-text h4 {
  font-size: 16px;
  font-weight: bold;
  color: black;
}
.discount-list .discount-list-item .list-item-text .item-price {
  color: red;
  font-size: 16px;
}
.discount-list .discount-list-item .list-item-text .item-thumbs {
  margin-top: 10px;
  padding: 0 5px;
  display: flex;
  justify-content: space-between;
}
.more-news {
  margin-top: 10px;
  width: 100%;
  height: 60px;
  text-align: center;
  box-sizing: border-box;
}
.more-news button {
  width: 94%;
  box-sizing: border-box;
  height: 40px;
  line-height: 40px;
  margin: 5px 10px;
  background: #b8b2b2;
  border-radius: 10px;
  border: 1px solid #a39d9d;
}
</style>